package com.helloSpring.example.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
//@RequestMapping("/helloSpring")
public class HelloController {
    //真实访问地址: 项目名/helloSpring/hello
    @RequestMapping("/hello")
    public String hello(Model model){

        //向模型中添加属性msg与值,可以在jsp页面中取出并渲染
        model.addAttribute("msg","Hello,SpringMVC!");

        //  WEB-INF/jsp/hello.jsp
        return "hello";
    }

}
